# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: dorphell <dorphell@archlinux.org>
# Committer: Judd Vinet <jvinet@zeroflux.org>

pkgname=xplanet
pkgver=1.3.1
pkgrel=5
pkgdesc="An Xearth wannabe"
arch=(loong64 x86_64)
url="http://xplanet.sourceforge.net/"
license=('GPL')
depends=('pango' 'giflib' 'libtiff' 'libxss')
source=(https://downloads.sourceforge.net/project/xplanet/xplanet/$pkgver/xplanet-$pkgver.tar.gz
	giflib6.patch xplanet-c++11.patch)
sha256sums=('4380d570a8bf27b81fb629c97a636c1673407f4ac4989ce931720078a90aece7'
            'b42e3438e969713bcba6188669507bb23fde004598c070c4196a554ed5787be4'
            'e651c7081c43ea48090186580b5a2a5d5039ab3ffbf34f7dd970037a16081454')

prepare() {
  cd "$srcdir"/$pkgname-$pkgver
  patch -p1 <"$srcdir"/giflib6.patch
  patch -p1 -i ../xplanet-c++11.patch # Fix build with C++11 (Gentoo)
  sed -e 's|freetype-config|pkg-config freetype2|g' -i acinclude.m4
  autoreconf -vif
}

build() {
  cd "$srcdir"/$pkgname-$pkgver
  ./configure --prefix=/usr --with-freetype
  make
}

package() {
  cd "$srcdir"/$pkgname-$pkgver
  make prefix="$pkgdir"/usr install
}
